import api from './api';
export default {
    data() {
        return {};
    },
    wxRequest(method, url, data, callback, errFun, hostName) {
        // console.log(api.api_host);
        let host = hostName ? api[hostName] : api.api_host;
        uni.request({
            url: host + url,
            method: method,
            data: data,
            header: {
                'content-type': method == 'GET' ? 'application/x-www-form-urlencoded' : 'application/json',
                Accept: 'application/json'
            },
            success: (res) => {
                callback(res.data);
            },
            fail: (err) => {
                errFun(err);
            }
        });
    }
};
